<%--
  Created by IntelliJ IDEA.
  User: oldliu
  Date: 2022/7/7
  Time: 10:48
  To change this template use File | Settings | File Templates.
--%>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>新生注册</title>
</head>
<body>
  <form method="post" action="doAddStudent.jsp" enctype="multipart/form-data">
      <h1>新生注册</h1>
      <p>
      <input type="text" name="sname" required placeholder="姓名"/>
  </p>
      <p>
          <input type="text" name="telephone"  placeholder="手机号"/>
      </p>
      <p>
          <input type="file" name="idcardpic" accept="image/*"  placeholder="身份证正面照" onchange="setImagePreviews(this);"/>
         <img src="#" id="preview" height="200px" width="150px"/>
      </p>
      <p>
          <input type="submit" value="注册"/>
      </p>
  </form>
<script>
    function setImagePreviews(t){
        var file = t.files[0];//获取input上传1var img = new Image();
        var url = window.URL.createObjectURL(file);//得到bolb对象路径，可当成img.src = url;
        document.getElementById("preview").src=url;

    }
</script>
</body>
</html>
